Adding some more judges, here and there.
[and.git] / UVa / 357 - Let me count the ways / Intentando ayudar / 357.cpp
blobf38b7ab9e377e7f6e04e7cbdb6252c65b291979b
1 /*
2 Accepted
3 */
4 #include <stdio.h>
5 #define MAX 30000
6 long long ways[MAX+1];
7 int coin[5] = { 50,25,10,5,1 };
9 int main()
12 int i,j,n,c;
13 for(i=1; i<=MAX; i++) ways[i] = 0;
14 ways[0] = 1;
15 for (i=0; i<5; i++)
17 c = coin[i];
18 for (j=c; j<=MAX; j++)
19 ways[j] += ways[j-c];
21 while(scanf("%d",&n) == 1)
23 if (ways[n] == 1)
24 printf("There is only 1 way to produce %d cents change.\n", n);
25 else
26 printf("There are %lld ways to produce %d cents change.\n",ways[n],n);
28 return 0;